#ifndef _UDP_NET_COMMUNICATION_HEAD_H
#define _UDP_NET_COMMUNICATION_HEAD_H
#include <vector>
#include <istream>
#include "net-communication.h"
#include <sys/types.h> /* See NOTES */
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>

using namespace std;

class UdpNetCommunication : public NetCommunication
{
public:
	UdpNetCommunication(const string &localIP = "127.0.0.0", uint32_t localPort = 8899);
	bool sendPacket(const vector<uint8_t> &packet);
	bool recvPacket(vector<uint8_t> &packet, int timeout = -1);

private:
	int      fd;
	string   peerIP;
	uint16_t peerPort;
};

#endif